home *** CD-ROM | disk | FTP | other *** search
/ .net 2002 March / DotNetMagazine-Issue107-Coverdisc-NET107-02-03-PCMac.bin / pc / PC Software / free_browsing / DavesQckSearchDbar3-14 / dqsd.exe / searches / ystocks.xml < prev    next >
Text File  |  2002-08-30  |  5KB  |  146 lines

  1. <search function="ystocks">
  2.   <name>Yahoo Finance</name>
  3.   <description>Use Yahoo Finance to find information about specific stocks.<br />
  4.     <a class="helpboxDescLabels">Info Mode:</a> (default): use to lookup stock symbols: "ystocks C /chart".  Optional switches:<br />
  5.     basic (default),  daywatch,  performance,  realtime,  detailed,  chart,  research,  options,  orderbook<br />
  6.  
  7.     <a class="helpboxDescLabels">Lookup Mode:</a> (/lookup): Use to find symbols. "ystocks /lookup Citigroup".  Optional switches:<br />
  8.     Market:  world or us (default)<br />
  9.     Instrument Type: any (default),  stocks,  options,  funds,  index<br />
  10.   </description>
  11.   <category>Finance</category>
  12.   <link>http://finance.yahoo.com/</link>
  13.   <contributor>Neel Doshi</contributor>
  14.   <form name="ystocksf1"
  15.         action="http://finance.yahoo.com/q"
  16.         method="post">
  17.     <input type="hidden" name="h" value="1" />
  18.     <input type="hidden" name="s" />
  19.     <input type="hidden" name="d" value="v1" />
  20.   </form>
  21.   <form name="ystocksf2"
  22.         action="http://finance.yahoo.com/l"
  23.         method="post">
  24.     <input type="hidden" name="m" value="US" />
  25.     <input type="hidden" name="s" />
  26.     <input type="hidden" name="t" value="" />
  27.   </form>
  28.   <script><![CDATA[
  29.     function ystocks(q)
  30.     {
  31.         if( nullArgs("ystocks", q ) )
  32.             return false;
  33.  
  34.         // Layout all of the possible switches.
  35.         var switch_list_searches = new Array("basic", "daywatch", "performance", "realtime", "detailed", "chart", "research", "options", "orderbook");
  36.         var switch_list_markets = new Array("us", "world");
  37.         var switch_list_lookup = new Array("any", "stocks", "options", "funds", "index");
  38.         var switch_list_modes = new Array("info", "lookup");
  39.         var switch_list = new Array();
  40.         switch_list = switch_list_modes.concat(switch_list_markets).concat(switch_list_searches).concat(switch_list_lookup);
  41.  
  42.         // Parse the arguments.
  43.         var args = parseArgs(q, switch_list);
  44.  
  45.         // determine if the mode is info (default) or lookup
  46.         var FuncMode = "info";
  47.         if ( typeof args.switch_val[ "lookup" ] != "undefined")
  48.             FuncMode = "lookup"
  49.  
  50.         if (FuncMode == "lookup")
  51.         {
  52.             // Iterate through market switch list to determine which market the user wants to search
  53.             document.ystocksf2.m.value = "US";
  54.             for (var j = 0; j < switch_list_markets.length; j++)
  55.             {
  56.                 if ( typeof args.switch_val[ switch_list_markets[j] ] != "undefined")
  57.                 {
  58.                     switch( switch_list_markets[j].toLowerCase() )
  59.                     {
  60.                     case "us":
  61.                         document.ystocksf2.m.value = "US"; break;
  62.                     case "world":
  63.                         document.ystocksf2.m.value = ""; break;
  64.                     default:
  65.                         document.ystocksf2.m.value = "US"; break;
  66.                     }
  67.                 }
  68.             }
  69.             // Iterate through the lookup switch list to determine what kind of lookup the user wants
  70.             document.ystocksf2.t.value = "";
  71.             for (var j = 0; j < switch_list_lookup.length; j++)
  72.             {
  73.                 if ( typeof args.switch_val[ switch_list_lookup[j] ] != "undefined")
  74.                 {
  75.                     switch( switch_list_lookup[j].toLowerCase() )
  76.                     {
  77.                     case "any":
  78.                         document.ystocksf2.t.value = ""; break;
  79.                     case "stocks":
  80.                         document.ystocksf2.t.value = "S"; break;
  81.                     case "options":
  82.                         document.ystocksf2.t.value = "O"; break;
  83.                     case "funds":
  84.                         document.ystocksf2.t.value = "M"; break;
  85.                     case "index":
  86.                         document.ystocksf2.t.value = "I"; break;
  87.                     default:
  88.                         document.ystocksf2.t.value = ""; break;
  89.                     }
  90.                 }
  91.             }
  92.  
  93.             // Set the query and submit the form
  94.             document.ystocksf2.s.value = args.q;
  95.             submitForm(ystocksf2);
  96.             return true;
  97.         }
  98.         else
  99.         {
  100.             // Iterate through the switch_list_searches switch list to determine what kind of search the user wants
  101.             document.ystocksf1.d.value = "v1";
  102.             for (var j = 0; j < switch_list_searches.length; j++)
  103.             {
  104.                 if ( typeof args.switch_val[ switch_list_searches[j] ] != "undefined")
  105.                 {
  106.                     switch( switch_list_searches[j].toLowerCase() )
  107.                     {
  108.                     case "basic":
  109.                         document.ystocksf1.d.value = "v1"; break;
  110.                     case "daywatch":
  111.                         document.ystocksf1.d.value = "v2"; break;
  112.                     case "performance":
  113.                         document.ystocksf1.d.value = "v3"; break;
  114.                     case "realtime":
  115.                         document.ystocksf1.d.value = "e"; break;
  116.                     case "detailed":
  117.                         document.ystocksf1.d.value = "t"; break;
  118.                     case "chart":
  119.                         document.ystocksf1.d.value = "c"; break;
  120.                     case "research":
  121.                         document.ystocksf1.d.value = "r"; break;
  122.                     case "options":
  123.                         document.ystocksf1.d.value = "o"; break;
  124.                     case "orderbook":
  125.                         document.ystocksf1.d.value = "f8"; break;
  126.                     default:
  127.                         document.ystocksf1.d.value = ""; break;
  128.                     }
  129.                 }
  130.             }
  131.  
  132.             // Set the query and submit the form
  133.             document.ystocksf1.s.value = args.q;
  134.             submitForm(ystocksf1);
  135.             return true;
  136.         }
  137.     }
  138.   ]]></script>
  139.  
  140.   <copyright>
  141.     Copyright (c) 2002 David Bau
  142.     Distributed under the terms of the
  143.     GNU Public License, Version 2 (http://www.gnu.org/copyleft/gpl.txt)
  144.   </copyright>
  145. </search>
  146.